# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=geoclue

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.12.99
pkgrel=1
arch=('any')
pkgdesc="Modular Geoinformation Service (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-glib2" "${MINGW_PACKAGE_PREFIX}-gtk2" "${MINGW_PACKAGE_PREFIX}-libxml2" "${MINGW_PACKAGE_PREFIX}-libxslt" "${MINGW_PACKAGE_PREFIX}-dbus-glib")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-python2" "gtk-doc" )
optdepends=('libsoup-gnome: Skyhook location provider')
options=('strip' 'staticlibs')
license=("BSD")
url="http://geoclue.freedesktop.org/"
source=(http://freedesktop.org/~hadess/${_realname}-$pkgver.tar.gz
    geoclue-0.12.0-win32reloc.patch
    geoclue-0.12.99-ldflags.patch
    )
md5sums=('779245045bfeeec4853da8baaa3a18e6'
         '175021cc9767407260908f315d3c36d3'
         'b446a0942aaa88bfbc2e8ec47bb24877')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/geoclue-0.12.0-win32reloc.patch
  patch -p1 -i ${srcdir}/geoclue-0.12.99-ldflags.patch
  autoreconf -f -i
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --enable-shared \
    --disable-static
  make
}

package() {
    cd "$srcdir/build-${MINGW_CHOST}"
    make DESTDIR=$pkgdir install
    find "${pkgdir}${MINGW_PREFIX}" -name '*.def' -o -name '*.exp' | xargs -rtl1 rm
  rm -rf "${pkgdir}${MINGW_PREFIX}"/share/man
    #rm -rf "${pkgdir}${MINGW_PREFIX}"/{etc,var,libexec,share}
}
